package com.hxci.zhongjiahao.servcie;

import com.hxci.zhongjiahao.dao.CourseMapper;
import com.hxci.zhongjiahao.pojo.Course;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service("zhongjiahaoCorseServiceImp")
public class CorseServiceImp implements CorseService {
    @Autowired
    CourseMapper mapper;

    @Override
    public List<Course> query(Course  course) {
        return mapper.query(course);
    }

    @Override
    public Integer del(String id) {
        return mapper.del(id);
    }

    @Override
    public Integer save(Course course) {
        if(course.getId() != null){
            return mapper.update(course);
        }else {
            return mapper.save(course);
        }
    }

    @Override
    public Course queryBySno(String sno) {
        return mapper.queryBySno(sno);
    }

    @Override
    public List<Course> queryByTeacher(String teacher) {
        return mapper.queryByTeacher(teacher);
    }
    
    @Override
    public List<Course> queryAll() {
        return mapper.queryAll();
    }
    
    @Override
    public List<String> queryCategories() {
        return mapper.queryCategories();
    }
    
    @Override
    public List<Course> queryByCategory(String category) {
        return mapper.queryByCategory(category);
    }
}